
/**
	欧拉角,工具
*/
class EulerAnglesTool{
	/**
		欧拉转换为四元数.
	*/
	static function ToQuaternion(eulerAngles:Vector3):Quaternion{
		var h:float = eulerAngles.y;
		var p:float = eulerAngles.x;
		var b:float = eulerAngles.z;
		
		var sinHOver2:float = Mathf.Sin(h * 0.5f);
		var cosHOver2:float = Mathf.Cos(h * 0.5f);
		var sinPOver2:float = Mathf.Sin(p * 0.5f);
		var cosPOver2:float = Mathf.Cos(p * 0.5f);
		var sinBOver2:float = Mathf.Sin(b * 0.5f);
		var cosBOver2:float = Mathf.Cos(b * 0.5f);
		
		var w:float = cosHOver2 * cosPOver2 * cosBOver2 + sinHOver2 * sinPOver2 * sinBOver2;
		var x:float = cosHOver2 * sinPOver2 * cosBOver2 + sinHOver2 * cosPOver2 * sinBOver2;
		var y:float = sinHOver2 * cosPOver2 * cosBOver2 - cosHOver2 * sinPOver2 * sinBOver2;
		var z:float = cosHOver2 * cosPOver2 * sinBOver2 - sinHOver2 * sinPOver2 * cosBOver2;
		return Quaternion(x,y,z,w);
	}
}